<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <h2>{{msg}}</h2>
        <h2 v-once>v-once:{{msg}}</h2>
        <h2 v-pre>v-pre{{msg}}</h2>
        <input v-model="msg">
        <ul v-for="(v,i) in goods">
            <template>
                <li>{{i+1}} {{v}}
                    <button @click="goods.pop(i)">删除</button>
                </li>
            </template>
           
            
        </ul>
        <template v-for="(v,k) in huowu">
            <div>
                <span>{{k}}</span> {{v.name}} {{v.price}} {{huowu[k].name}}
                <span @click="dell">删除</span>
            </div>
            
        </template>
        <div v-if="goods.length">
                一共有{{goods.length}}种水果。
        </div>
        <div v-else>没有任何水果！</div>
        <button @click="goods.pop()">删除一种水果</button>
    </div>
    <script src="vue.js"></script>
    <script>
        var vm = new Vue({
            el:"#app",
				data:{
                    msg:"hello world",
                    seen:true,
                    goods:['苹果','香蕉','梨','橘子'],
                    huowu:[{name:"p30",price:"3980"},
                            {name:"p20",price:"2000"}]
                },
                methods:{
                    del:function(){
                        this.goods.pop()
                    },
                    dell:function(){
                        this.huowu.pop()
                    },
                    // shanchu:function(){
                    //     this.goods.splice
                    // }
                }
        });
    </script>
</body>
</html>